<?php
// src/Pyaf/GymBundle/Repository/PaqueteRutinaRepository.php
namespace Pyaf\GymBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * Description of PaqueteRutinaRepository
 *
 * @author Toshiba P755-S5272
 */
class PaqueteRutinaRepository extends EntityRepository{
    
    public function findAllOrderByNombre() {                
        return $this->getEntityManager()
                    ->createQuery('SELECT pr FROM PyafGymBundle:PaqueteRutina pr ORDER BY pr.nombre ASC')
                    ->getResult();
    }
    
    public function findPaqueteRutina($id) {                
        return $this->getEntityManager()
                    ->createQuery("SELECT pr FROM PyafGymBundle:PaqueteRutina pr WHERE pr.id = $id")
                    ->getOneOrNullResult();
    }
    
    public function save($paqueteRutina){
        $this->savePaqueteRutina($paqueteRutina);
    }
    
    public function savePaqueteRutina($paqueteRutina) {
        $em = $this->getEntityManager();
        $em->persist($paqueteRutina);
        $em->flush();
    }
}

?>
